home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / asyam.zip / LINE.C < prev    next >
C/C++ Source or Header  |  1993-06-24  |  1KB  |  66 lines

  1. #include <dos.h>
  2.  
  3. #include "async.h"
  4.  
  5. extern  int UART_ports[];
  6.  
  7. int     async_LCR(int comport)
  8. {
  9.     return (inportb(UART_ports[comport]+LCR));
  10. }
  11.  
  12. int     async_MCR(int comport)
  13. {
  14.     return (inportb(UART_ports[comport]+MCR));
  15. }
  16.  
  17. int     async_LSR(int comport)
  18. {
  19.     return (inportb(UART_ports[comport]+LSR));
  20. }
  21.  
  22. int     async_MSR(int comport)
  23. {
  24.     return (inportb(UART_ports[comport]+MSR));
  25. }
  26.  
  27. int     async_DTR_status(int comport)
  28. {
  29.     return (inportb(UART_ports[comport]+MCR)&0x01);
  30. }
  31.  
  32. int     async_RTS_status(int comport)
  33. {
  34.     return ((inportb(UART_ports[comport]+MCR)&0x02)?1:0);
  35. }
  36.  
  37. void    async_set_DTR(int comport, int status)
  38. {
  39.     int dtr;
  40.  
  41.     dtr = inportb(UART_ports[comport]+MCR);
  42.  
  43.     if (status) {
  44.         dtr |= 0x01;
  45.     } else {
  46.         dtr ^= 0x01;
  47.     }
  48.  
  49.     outportb(UART_ports[comport]+MCR, dtr);
  50. }
  51.  
  52. void    async_set_RTS(int comport, int status)
  53. {
  54.     int rts;
  55.  
  56.     rts = inportb(UART_ports[comport]+MCR);
  57.  
  58.     if (status) {
  59.         rts |= 0x02;
  60.     } else {
  61.         rts ^= 0x02;
  62.     }
  63.  
  64.     outportb(UART_ports[comport]+MCR, rts);
  65. }
  66.